package next.fire.mq.client;

import com.talkyun.utils.json.JSON;
import next.fire.mq.client.test.model.User;
import next.rapid.test.RapidTestCase;

import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.TimeUnit;

public class JsonCode extends RapidTestCase {

    public static void main(String[] args) {
        User user = new User();
        user.setName("kk01");
        user.setBirthday(new Date());
        user.setAge(16);

        user.setFriends(new ArrayList<>());
        User user2 = new User();
        user2.setName("kk02");
        user2.setBirthday(new Date());
        user2.setAge(16);

        user.getFriends().add(user2);

        String json = JSON.toJsonString(user);
        System.out.println(json);

        User user3 = JSON.toJavaObject(json, User.class);
        System.out.println(user3);

        JsonCode jc = new JsonCode();
        jc.rapidAssertEqual(user, user3);


        TimeUnit.SECONDS.toMicros(1);

        System.out.println(TimeUnit.MINUTES.toMillis(1));
    }
}
